package com.zfl.thread.day01;

/**
 * 创建线程方式 2，实现runnable接口
 * 自定义类implements Runnbale接口，override run(){}
 * 创建自定义类
 * 创建Thread，传入自定义类
 * 调用Thread.start
 */

public class Demo04 {

    public static void main(String[] args) {
        new Thread(()->{
            for (int i = 0; i < 100; i+=2) {
                System.out.println(Thread.currentThread().getName()+"-"+i+"-");
            }
        },"偶数线程").start();
        new Thread(()->{
            for (int i = 1; i < 100; i+=2) {
                System.out.println(Thread.currentThread().getName()+"-"+i+"-");
            }
        },"奇数线程").start();
    }
}
